package com.mareas.web.service.impl;

import java.util.List;

import javax.faces.bean.ApplicationScoped;
import javax.faces.bean.ManagedBean;

import org.springframework.stereotype.Service;

import com.mareas.web.dao.Dao;
import com.mareas.web.model.Buque;
import com.mareas.web.service.BuqueService;

@Service
@ManagedBean
@ApplicationScoped
public class BuqueServiceImpl implements BuqueService {

	private Dao dao;

	public Buque newBuque() {
		return new Buque();
	}

	public void persist(Buque buque) {
		dao.persist(buque);
	}

	public void update(Buque buque) {
		dao.update(buque);
	}
	
	public List<Buque> getBuques() {
		final List<Buque> list = dao.find(Buque.class);
		return list;
	}

	public Buque get(Integer id) {
		final Buque buque = dao.load(Buque.class, id);
		return buque;
	}

	public void remove(Buque buque) {
		this.dao.remove(buque);
	}

	public Dao getDao() {
		return dao;
	}

	public void setDao(Dao dao) {
		this.dao = dao;
	}

}
